package com.item.service;

import com.zhx.distributedredission.annotation.DistributedLock;
import com.zhx.distributedredission.annotation.LockParameter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author zhang-rongyao
 * @Package com.item.service
 * @date 2021/10/22
 * @Version v1.0.0
 */
@Slf4j
@Service
public class Test {

    @DistributedLock(value = "rediss-", leaseTime = 10)
    public String tets(@LockParameter String parentName) {


        try {
            Thread.sleep(20000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("============" + parentName);

        return "ok";
    }
}
